package ch.sv7.tool.dbmanager.db.difference.filter;

import java.util.Set;

import ch.sv7.tool.dbmanager.StringUtil;
import ch.sv7.tool.dbmanager.db.difference.SchemaDifference;

/**
 * TODO: Document me!
 *
 * @author svt
 *
 */
public class NameExcludeDifferenceFilter implements DifferenceFilter {
	
	private Set excludeSet;
	
	public NameExcludeDifferenceFilter(String exclusions) {
		this.excludeSet = StringUtil.commaSeparatedToSet(exclusions);
	}
	
	public boolean keep(SchemaDifference difference) {
		String className = difference.getClass().getName();
		String shortClassName = className.substring(className.lastIndexOf(".") + 1);
		return !(excludeSet.contains(shortClassName));
	}

}
